package com.tanhua.model.vo;


import com.tanhua.model.db.UserInfo;
import com.tanhua.model.mongo.Voice;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;

/**
 * 封装接收语音返回
 *
 * @author LiuKeLin
 * @title: VoiceVo
 * @projectName tanhua-practice
 * @description: TODO
 * @date 2022/2/219:14
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class VoiceVo implements Serializable {

    /**
     * 语音用户id
     */
    private Long id;

    /**
     * 语音用户头像
     */
    private String avatar;

    /**
     * 语音用户名称
     */
    private String nickname;

    /**
     * 语音用户性别
     */
    private String gender;

    /**
     * 语音用户年龄
     */
    private Integer age;

    /**
     * 语音地址
     */
    private String soundUrl;

    /**
     * 语音次数
     */
    private Integer remainingTimes;

    public static VoiceVo init(UserInfo userInfo, Voice voice) {
        VoiceVo vo = new VoiceVo();
        BeanUtils.copyProperties(userInfo, vo);
        BeanUtils.copyProperties(voice, vo);
        return vo;
    }
}
